<template>
    <div class="doc-assistant">
      <!-- 页面加载动画 -->
      <div v-if="isAnalyzing" class="page-loading-overlay">
        <div class="loading-container">
          <div class="loading-spinner">
            <div class="spinner-ring"></div>
            <div class="spinner-ring"></div>
            <div class="spinner-ring"></div>
          </div>
          <div class="loading-text">
            <h3>正在审核分析中...</h3>
            <p>{{ currentLoadingStep }}</p>
          </div>
        </div>
      </div>
      
      <div class="assistant-container">
        <!-- 左侧配置区域 -->
        <div class="left-panel">
          <!-- 工程方案上传 -->
          <div class="upload-section">
            <div class="section-title">
              <el-icon><Upload /></el-icon>
              上传工程方案
            </div>
            <div 
              class="upload-area"
              :class="{ 'is-dragover': isDragOver }"
              @click="triggerUpload"
              @drop="handleDrop"
              @dragover="handleDragOver"
              @dragleave="handleDragLeave"
            >
              <div class="upload-content">
                <el-icon class="upload-icon" size="48"><DocumentAdd /></el-icon>
                <div class="upload-text">
                  <div class="upload-title">点击上传或拖拽文件到此区域</div>
                  <div class="upload-desc">支持 PDF、Word 格式，单文件不超过 500MB</div>
                </div>
              </div>
            </div>
            
            <!-- 已上传文件列表 -->
            <div v-if="uploadedFiles.length > 0" class="uploaded-files">
              <div v-for="file in uploadedFiles" :key="file.id" class="file-item">
                <div class="file-icon">
                  <el-icon size="20"><Document /></el-icon>
                </div>
                <div class="file-info">
                  <div class="file-name">{{ file.name }}</div>
                  <div class="file-size">{{ formatFileSize(file.size) }}</div>
                </div>
                <div class="file-actions">
                  <el-button
                    type="danger"
                    size="small"
                    text
                    @click="removeFile(file.id)"
                  >
                    <el-icon><Delete /></el-icon>
                  </el-button>
                </div>
              </div>
            </div>
          </div>
  
          <!-- 方案类型选择 -->
          <div class="config-section">
            <div class="section-title">
              <el-icon><Collection /></el-icon>
              方案类型
            </div>
            <el-select
              v-model="selectedSolutionTypes"
              multiple
              placeholder="请选择方案类型"
              style="width: 100%"
              :max-collapse-tags="3"
              collapse-tags-tooltip
            >
              <el-option
                v-for="type in solutionTypes"
                :key="type.value"
                :label="type.label"
                :value="type.value"
              />
            </el-select>
          </div>
  
                  <!-- 审核文件 -->
          <div class="config-section">
            <div class="section-title">
              <el-icon><Folder /></el-icon>
              审核文件
            </div>
            
                      <!-- 企业知识库分类 -->
            <div class="sub-config-item">
              <div class="sub-title">
                <el-icon><Collection /></el-icon>
                企业知识库分类
              </div>
              <el-tree-select
                v-model="selectedKnowledgeCategory"
                :data="knowledgeCategories"
                placeholder="请选择企业知识库分类"
                style="width: 100%"
                @change="onKnowledgeCategoryChange"
                clearable
                check-strictly
                :render-after-expand="false"
                node-key="value"
                :props="{
                  children: 'children',
                  label: 'label',
                  value: 'value'
                }"
              />
            </div>
  
            <!-- 文档选择 -->
            <div class="sub-config-item" :class="{ disabled: currentCategoryDocuments.length === 0 }">
              <div class="sub-title">
              <el-icon><DataBoard /></el-icon>
                企业知识库
                <span v-if="selectedKnowledgeCategory" class="category-info">
                  ({{ currentCategoryDocuments.length }} 个文档)
                </span>
            </div>
              <div v-if="currentCategoryDocuments.length > 0" class="document-list">
                <el-checkbox-group v-model="selectedDocuments">
                  <div v-for="doc in currentCategoryDocuments" :key="doc.id" class="document-item">
                    <el-checkbox :label="doc.id" class="document-checkbox">
                      <div class="document-info">
                        <div class="document-name">{{ doc.name }}</div>
                        <div class="document-meta">
                          <span class="document-size">{{ formatFileSize(doc.size) }}</span>
                          <span class="document-date">{{ doc.uploadDate }}</span>
                        </div>
                      </div>
                    </el-checkbox>
                    <el-button 
                      type="text" 
                      size="small" 
                      @click="viewDocument(doc.id)"
                      class="view-document-btn"
                    >
                      <el-icon><View /></el-icon>
                      查看
                    </el-button>
                  </div>
                </el-checkbox-group>
              </div>
              <div v-else class="form-tip">
              请先选择企业知识库分类
              </div>
            </div>
          </div>
  
          <!-- 操作按钮 -->
          <div class="action-buttons">
            <el-button
              type="primary"
              size="large"
              :disabled="!canRunAnalysis"
              @click="runAnalysis"
              class="run-button"
            >
              <el-icon v-if="!isAnalyzing"><VideoPlay /></el-icon>
              <el-icon v-else class="loading-icon"><Loading /></el-icon>
              {{ isAnalyzing ? '审核分析中...' : '开始审核' }}
            </el-button>
            <el-button
              size="large"
              @click="clearSelections"
            >
              <el-icon><Refresh /></el-icon>
              清空选择
            </el-button>
          </div>
        </div>
  
        <!-- 右侧文档区域 -->
        <div class="right-panel">
          <div class="panel-header">
            <h3>{{ selectedDocumentForView ? selectedDocumentForView.name : '方案审核预览' }}</h3>
          </div>
  
          <!-- 文档内容显示 -->
          <div v-if="selectedDocumentForView" class="document-content">
            <!-- 审核结果摘要 -->
            <div v-if="analysisResult" class="audit-summary">
              <div class="summary-header">
                <h4>审核结果摘要</h4>
                <div class="compliance-rate">
                  <div class="rate-circle">
                    <span class="rate-number">{{ analysisResult.complianceRate }}%</span>
                    <span class="rate-label">合规率</span>
                  </div>
                </div>
              </div>
              
              <div class="summary-stats">
                <div class="stat-item total">
                  <div class="stat-icon">
                    <el-icon><Document /></el-icon>
                  </div>
                  <div class="stat-content">
                    <div class="stat-number">{{ analysisResult.totalEvaluationItems }}</div>
                    <div class="stat-label">总评估项</div>
                  </div>
                </div>
                <div class="stat-item pass">
                  <div class="stat-icon">
                    <el-icon><Check /></el-icon>
                  </div>
                  <div class="stat-content">
                    <div class="stat-number">{{ analysisResult.compliantItems }}</div>
                    <div class="stat-label">合规项</div>
                  </div>
                </div>
                <div class="stat-item error">
                  <div class="stat-icon">
                    <el-icon><CircleClose /></el-icon>
                  </div>
                  <div class="stat-content">
                    <div class="stat-number">{{ analysisResult.nonCompliantItems }}</div>
                    <div class="stat-label">不合规项</div>
                  </div>
                </div>
              </div>
              
              <!-- 问题列表 -->
              <div v-if="getCurrentDocumentIssues().length > 0" class="issues-list">
                <div class="issues-header">
                  <h5>发现的问题</h5>
                  <span class="issues-count">{{ getCurrentDocumentIssues().length }} 个问题</span>
                </div>
                <div 
                  v-for="(issue, index) in getCurrentDocumentIssues()" 
                  :key="index"
                  class="issue-item"
                  :class="`issue-${issue.type}`"
                >
                  <div class="issue-header">
                    <div class="issue-title-section">
                      <span class="issue-serial-number">{{ index + 1 }}.</span>
                      <span class="issue-title">{{ issue.title }}</span>
                    </div>
                    <div class="issue-meta">
                      <span class="issue-type" :class="`type-${issue.type}`">
                        {{ getIssueTypeLabel(issue.type) }}
                      </span>
                      <span class="issue-severity" :class="`severity-${issue.severity}`">
                        {{ getSeverityLabel(issue.severity) }}
                      </span>
                    </div>
                  </div>
                  <div class="issue-description">{{ issue.description }}</div>
                  <div v-if="issue.suggestion" class="issue-suggestion">
                    <strong>改进建议：</strong>{{ issue.suggestion }}
                  </div>
                  <div v-if="issue.annotations && issue.annotations.length > 0" class="issue-location">
                    <strong>问题位置：</strong>{{ issue.annotations[0].position }}
                  </div>
                </div>
              </div>
            </div>

            <!-- 文档查看器 -->
            
            <!-- 下载报告按钮 -->
            <div v-if="analysisResult" class="download-section">
              <el-button 
                type="primary" 
                size="large" 
                @click="downloadReport"
                :loading="isDownloading"
                class="download-btn"
              >
                <el-icon><Download /></el-icon>
                下载审核报告
              </el-button>
              <div class="download-info">
                <span class="info-text">报告包含详细的审核结果、问题分析和改进建议</span>
              </div>
            </div>
          </div>

          <!-- 空状态 - 显示审核结果概览 -->
          <div v-else-if="analysisResult" class="audit-overview">
            <div class="overview-header">
              <h4>审核结果概览</h4>
              <p>已分析 {{ analysisResult.totalDocuments }} 个文档</p>
            </div>
            
            <div class="overview-stats">
              <div class="stat-card pass">
                <div class="stat-icon">
                  <el-icon><Check /></el-icon>
                </div>
                <div class="stat-content">
                  <div class="stat-number">{{ analysisResult.passedDocuments }}</div>
                  <div class="stat-label">通过审核</div>
                </div>
              </div>
              
              <div class="stat-card warning">
                <div class="stat-icon">
                  <el-icon><Warning /></el-icon>
                </div>
                <div class="stat-content">
                  <div class="stat-number">{{ analysisResult.warningDocuments }}</div>
                  <div class="stat-label">需要改进</div>
                </div>
              </div>
              
              <div class="stat-card error">
                <div class="stat-icon">
                  <el-icon><CircleClose /></el-icon>
                </div>
                <div class="stat-content">
                  <div class="stat-number">{{ analysisResult.errorDocuments }}</div>
                  <div class="stat-label">存在问题</div>
                </div>
              </div>
            </div>
            
            <div class="overview-actions">
              <el-button type="primary" @click="selectFirstDocument">
                <el-icon><View /></el-icon>
                查看详细结果
              </el-button>
            </div>
          </div>
  
          <!-- 空状态 -->
          <div v-else class="empty-state">
            <el-icon class="empty-icon" size="80"><DocumentCopy /></el-icon>
            <div class="empty-text">
              <div class="empty-title">请选择文档进行运行</div>
              <div class="empty-desc">在左侧上传工程方案后，点击左侧的运行"按钮</div>
            </div>
        </div>
      </div>
  </div>
      <!-- 隐藏的文件输入框 -->
      <input
        ref="fileInputRef"
        type="file"
        multiple
        accept=".pdf,.doc,.docx"
        style="display: none"
        @change="handleFileSelect"
      />
    </div>
  </template>
  <script setup lang="ts">
  import { ref, computed, onMounted } from 'vue'
  import { ElMessage, ElMessageBox } from 'element-plus'
  import {
    Upload,
    DocumentAdd,
    Document,
    Delete,
    Collection,
    Folder,
    DataBoard,
    VideoPlay,
    Refresh,
    DocumentCopy,
    View,
    EditPen,
    Check,
    ChatDotSquare,
    Close,
    Warning,
    CircleClose,
    Loading,
    Download
  } from '@element-plus/icons-vue'
  
  // 类型定义
  interface UploadedFile {
    id: string
    name: string
    size: number
    type: string
    file: File
    url?: string
  }
  
  interface SolutionType {
    value: string
    label: string
  }
  
  interface KnowledgeTreeNode {
    value: string
    label: string
    children?: KnowledgeTreeNode[]
  }
  
  interface DocumentInfo {
    id: string
    name: string
    type: string
    size: number
    uploadDate: string
    categoryPath: string[]
  }
  
  interface Annotation {
    id: string
    content: string
    position: {
      top: number
      left: number
    }
    selectedText: string
    suggestion?: string
    visible: boolean
  }
  
  interface AnalysisIssue {
    type: 'missing' | 'error' | 'warning' | 'info' | 'pass'
    severity: 'high' | 'medium' | 'low'
    title: string
    serialNumber: number
    description: string
    suggestion?: string
    annotations?: Array<{
      position: string
      content: string
    }>
  }
  
  interface AnalysisDocument {
    id: string
    name: string
    title: string
    status: 'pass' | 'warning' | 'error' | 'reviewed'
    issues?: AnalysisIssue[]
    missingContent?: string[]
    categoryPath: string[]
  }
  
  interface AnalysisResult {
    totalDocuments: number
    passedDocuments: number
    warningDocuments: number
    errorDocuments: number
    documents: AnalysisDocument[]
    // 新增：基于评审项的合规率计算
    totalEvaluationItems: number
    compliantItems: number
    nonCompliantItems: number
    complianceRate: number
  }
  
  
  
  // 响应式数据
  const fileInputRef = ref<HTMLInputElement>()
  const isAnalyzing = ref(false)
  const currentLoadingStep = ref('')
  const uploadedFiles = ref<UploadedFile[]>([])
  const isDragOver = ref(false)
  const isDownloading = ref(false)
  
  // 选择数据
  const selectedSolutionTypes = ref<string[]>([])
  const selectedKnowledgeCategory = ref<string>('')
  const selectedDocuments = ref<string[]>([])
  const currentCategoryDocuments = ref<DocumentInfo[]>([])
  const selectedDocumentForView = ref<DocumentInfo | null>(null)
  const annotations = ref<Annotation[]>([])
  const documentViewerRef = ref<HTMLElement>()
  const isAnnotationMode = ref(false)
  
  // 分析结果
  const analysisResult = ref<AnalysisResult | null>(null)
  
  // 选项数据
  const solutionTypes = ref<SolutionType[]>([
    { value: 'construction', label: '建筑施工方案' },
    { value: 'design', label: '设计方案' },
    { value: 'safety', label: '安全方案' },
    { value: 'quality', label: '质量控制方案' },
    { value: 'environment', label: '环保方案' },
    { value: 'technical', label: '技术方案' },
    { value: 'management', label: '管理方案' }
  ])
  
  // 企业知识库分类树状数据
  const knowledgeCategories = ref<KnowledgeTreeNode[]>([
    {
      value: 'shiyi-library',
      label: '十一智库-资料',
      children: [
        {
          value: 'external',
          label: '外部',
          children: [
            {
              value: 'regulations',
              label: '规范、图集',
              children: [
                {
                  value: 'construction-standards',
                  label: '施工规范、图集',
                  children: [
                    {
                      value: 'construction-regulations',
                      label: '施工规范',
                      children: [
                        { value: 'national-construction', label: '国家规范' },
                        { value: 'industry-construction', label: '行业规范' },
                        { value: 'local-construction', label: '地方规范' }
                      ]
                    },
                    {
                      value: 'construction-atlas',
                      label: '施工图集',
                      children: [
                        { value: 'national-atlas', label: '国家图集' },
                        { value: 'industry-atlas', label: '行业图集' },
                        { value: 'local-atlas', label: '地方图集' }
                      ]
                    }
                  ]
                },
                {
                  value: 'design-standards',
                  label: '设计规范、图集',
                  children: [
                    { value: 'electrical', label: '电' },
                    { value: 'building', label: '建筑' },
                    { value: 'structure', label: '结构' },
                    { value: 'heating', label: '暖' },
                    { value: 'water', label: '水' }
                  ]
                }
              ]
            }
          ]
        },
        {
          value: 'internal',
          label: '内部',
          children: [
            {
              value: 'shaanxi-construction-holding',
              label: '陕西建工控股集团有限公司',
              children: [
                { value: 'holding-regulations', label: '制度' },
                { value: 'holding-standards', label: '标准' },
                { value: 'holding-policies', label: '相关办法及通知' }
              ]
            },
            {
              value: 'shaanxi-construction-group',
              label: '陕西建工集团股份有限公司',
              children: [
                { value: 'group-regulations', label: '制度' },
                { value: 'group-standards', label: '标准' },
                { value: 'group-policies', label: '相关办法及通知' }
              ]
            },
            {
              value: 'shaanxi-11th-construction',
              label: '陕西建工第十一建设集团有限公司',
              children: [
                {
                  value: 'enterprise-system-compilation',
                  label: '企业制度汇编',
                  children: [
                    { value: 'business-category', label: '经营类' },
                    { value: 'production-category', label: '生产类' },
                    { value: 'safety-category', label: '安全类' },
                    { value: 'technology-achievement', label: '科技成果类' },
                    { value: 'technical-quality', label: '技术质量类' },
                    { value: 'business-affairs', label: '商务类' },
                    { value: 'finance-category', label: '财务类' },
                    { value: 'hr-management', label: '人力资源与干部管理类' },
                    { value: 'administrative', label: '行政类' },
                    { value: 'party-discipline', label: '党风廉政建设与纪检监察类' },
                    { value: 'audit-category', label: '审计类' },
                    { value: 'worker-rights', label: '职工权益保障类' },
                    { value: 'design-category', label: '设计类' },
                    { value: 'comprehensive-management', label: '综合管理类' }
                  ]
                },
                { value: 'enterprise-internal-control', label: '企业内部控制' },
                { value: 'standardization-manual', label: '标准化手册' },
                { value: 'process-standards-guide', label: '工艺标准指南' },
                {
                  value: 'professional-knowledge',
                  label: '专业知识',
                  children: [
                    {
                      value: 'tech-achievements',
                      label: '科技成果',
                      children: [
                        { value: 'papers', label: '论文' },
                        { value: 'patents', label: '专利' },
                        { value: 'construction-methods', label: '工法' }
                      ]
                    },
                    {
                      value: 'excellent-cases',
                      label: '优秀案例',
                      children: [
                        { value: 'enterprise-culture-type', label: '企业文化类' },
                        { value: 'party-innovation-type', label: '党建创新类' }
                      ]
                    },
                    { value: 'case-review-results', label: '案例复盘成果' },
                    { value: 'international-building-standards', label: '国际建筑说明通用规范' }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ])
  
  // 模拟文档数据
  const allDocuments = ref<DocumentInfo[]>([
    {
      id: 'doc1',
      name: 'GB50017-2017钢结构设计标准.pdf',
      type: 'pdf',
      size: 2457600,
      uploadDate: '2024-01-15',
      categoryPath: ['national-construction']
    },
    {
      id: 'doc2', 
      name: '混凝土结构设计规范.pdf',
      type: 'pdf',
      size: 3145728,
      uploadDate: '2024-01-20',
      categoryPath: ['national-construction']
    },
    {
      id: 'doc3',
      name: '施工现场临时用电安全技术规范.pdf',
      type: 'pdf',
      size: 1572864,
      uploadDate: '2024-02-01',
      categoryPath: ['industry-construction']
    },
    {
      id: 'doc4',
      name: '企业经营管理制度汇编.docx',
      type: 'docx',
      size: 1048576,
      uploadDate: '2024-02-10',
      categoryPath: ['business-category']
    },
    {
      id: 'doc5',
      name: '安全生产责任制度.pdf',
      type: 'pdf',
      size: 786432,
      uploadDate: '2024-02-15',
      categoryPath: ['safety-category']
    }
  ])
  
  // 计算属性
  const canRunAnalysis = computed(() => {
    return uploadedFiles.value.length > 0 
  })
  
  
  
  // 文件上传相关方法
  const triggerUpload = () => {
    fileInputRef.value?.click()
  }
  
  const handleFileSelect = (event: Event) => {
    const target = event.target as HTMLInputElement
    const files = target.files
    if (files) {
      handleFiles(Array.from(files))
      // 清空输入框
      target.value = ''
    }
  }
  
  const handleDragOver = (event: DragEvent) => {
    event.preventDefault()
    isDragOver.value = true
  }
  
  const handleDragLeave = (event: DragEvent) => {
    event.preventDefault()
    isDragOver.value = false
  }
  
  const handleDrop = (event: DragEvent) => {
    event.preventDefault()
    isDragOver.value = false
    
    const files = event.dataTransfer?.files
    if (files) {
      handleFiles(Array.from(files))
    }
  }
  
  const handleFiles = (files: File[]) => {
    const validFiles: File[] = []
    
    files.forEach(file => {
      // 文件类型验证
      const allowedTypes = [
        'application/pdf',
        'application/msword',
        'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
      ]
      
      if (!allowedTypes.includes(file.type)) {
        ElMessage.error(`不支持的文件类型: ${file.name}，仅支持 PDF、Word 格式`)
        return
      }
      
      // 文件大小验证 (500MB)
      if (file.size > 500 * 1024 * 1024) {
        ElMessage.error(`文件 ${file.name} 大小超过 500MB 限制`)
        return
      }
      
      // 检查是否重复
      const exists = uploadedFiles.value.some(existing => 
        existing.name === file.name && existing.size === file.size
      )
      
      if (exists) {
        ElMessage.warning(`文件 ${file.name} 已存在`)
        return
      }
      
      validFiles.push(file)
    })
    
    // 添加有效文件
    validFiles.forEach(file => {
      const uploadedFile: UploadedFile = {
        id: Date.now().toString() + Math.random().toString(36).substr(2, 9),
        name: file.name,
        size: file.size,
        type: file.type,
        file: file
      }
      uploadedFiles.value.push(uploadedFile)
    })
    
    if (validFiles.length > 0) {
      ElMessage.success(`成功添加 ${validFiles.length} 个文件`)
    }
  }
  
  const removeFile = (fileId: string) => {
    const index = uploadedFiles.value.findIndex(file => file.id === fileId)
    if (index > -1) {
      uploadedFiles.value.splice(index, 1)
      ElMessage.success('文件已移除')
    }
  }
  
  const formatFileSize = (bytes: number): string => {
    if (bytes === 0) return '0 B'
    const k = 1024
    const sizes = ['B', 'KB', 'MB', 'GB']
    const i = Math.floor(Math.log(bytes) / Math.log(k))
    return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + ' ' + sizes[i]
  }
  
  // 选择相关方法
  const onKnowledgeCategoryChange = () => {
    // 切换分类时加载对应文档并清空选择
    if (selectedKnowledgeCategory.value) {
      loadCategoryDocuments(selectedKnowledgeCategory.value)
    } else {
      currentCategoryDocuments.value = []
      selectedDocuments.value = []
    }
  }
  
  const loadCategoryDocuments = (categoryId: string) => {
    // 根据分类ID加载对应的文档
    currentCategoryDocuments.value = allDocuments.value.filter(doc => 
      doc.categoryPath.includes(categoryId)
    )
    selectedDocuments.value = [] // 清空选中的文档
  }
  
  // 文档查看相关方法
  const viewDocument = (documentId: string) => {
    const doc = allDocuments.value.find(d => d.id === documentId)
    if (doc) {
      selectedDocumentForView.value = doc
    }
  }
  
  
  
  // 批注功能相关方法
  const addAnnotation = () => {
    isAnnotationMode.value = !isAnnotationMode.value
    ElMessage.info(isAnnotationMode.value ? '请选择文本添加批注' : '退出批注模式')
  }
  
  const onTextSelection = () => {
    if (!isAnnotationMode.value) return
    
    const selection = window.getSelection()
    if (!selection || selection.rangeCount === 0) return
    
    const selectedText = selection.toString().trim()
    if (!selectedText) return
    
    const range = selection.getRangeAt(0)
    const rect = range.getBoundingClientRect()
    const viewerRect = documentViewerRef.value?.getBoundingClientRect()
    
    if (!viewerRect) return
    
    // 计算相对于文档查看器的位置
    const position = {
      top: rect.top - viewerRect.top + rect.height + 10,
      left: rect.left - viewerRect.left
    }
    
    // 创建新批注
    const newAnnotation: Annotation = {
      id: Date.now().toString(),
      content: '审核注释内容xxx',
      position,
      selectedText,
      suggestion: '审核依据xxx，索引来源xxx',
      visible: true
    }
    
    annotations.value.push(newAnnotation)
    
    // 清除选择
    selection.removeAllRanges()
    
    // 高亮选中的文本
    highlightSelectedText(range, newAnnotation.id)
  }
  
  const highlightSelectedText = (range: Range, annotationId: string) => {
    const span = document.createElement('span')
    span.className = 'highlighted-text'
    span.setAttribute('data-annotation-id', annotationId)
    
    try {
      range.surroundContents(span)
    } catch (e) {
      // 如果无法包围内容，则不高亮
      console.log('无法高亮选中文本')
    }
  }
  
  const onDocumentClick = () => {
    // 隐藏所有批注弹窗
    annotations.value.forEach(annotation => {
      annotation.visible = false
    })
  }

  const onIssueHighlightClick = (event: MouseEvent) => {
    const target = event.target as HTMLElement
    if (target.classList.contains('issue-highlight')) {
      // 显示问题详情
      const issueType = target.getAttribute('data-issue-type')
      const issueSeverity = target.getAttribute('data-issue-severity')
      const issueDescription = target.getAttribute('title')
      
      if (issueDescription) {
        ElMessage.info({
          message: issueDescription,
          duration: 5000,
          showClose: true
        })
      }
    } else {
      // 隐藏所有批注弹窗
      annotations.value.forEach(annotation => {
        annotation.visible = false
      })
    }
  }
  
  const showAnnotationDetail = (annotation: Annotation) => {
    // 隐藏其他批注
    annotations.value.forEach(ann => {
      if (ann.id !== annotation.id) {
        ann.visible = false
      }
    })
    // 显示当前批注
    annotation.visible = true
  }
  
  const hideAnnotation = (annotation: Annotation) => {
    annotation.visible = false
  }
  
  const saveAnnotations = () => {
    ElMessage.success('批注已保存')
    isAnnotationMode.value = false
  }
  
  // 模拟文档内容
  const getDocumentContent = (docId: string): string => {
    const contents: Record<string, string> = {
      'doc1': `# 高大支模专项施工方案施工组织设计／危大方案编制、审核、审批要点评审报告

## 1 编制
- **原文引用**  
  "2.1方案编制参照规范及标准：1)施工组织设计/方案编制主要参照规范及标准备注：以上索引规范、标准等可根据项目特点，增加或减少，规范年份可参照质量管理部'现行规范清单'或'工标网'进行查新。"
- **合规性**  
  不合规
- **不合规原因及依据**  
  虽提及参照规范，但未列出具体规范清单，且允许随意增减，未强调强制性条文合规。《10.施工总承包技术标编制要点指南》规定：编制依据必须列出完整规范清单(至少包括GB50010、JGJ162等核心规范)，并强调查新机制必须基于官方来源，不得随意增减以确保强制性条文覆盖。
- **改进建议**  
  补充完整规范清单(如GB50010-2010《混凝土结构设计规范》)，并明确禁止随意增减，添加强制性条文检查环节。

---

## 2 方案发起
- **原文引用**  
  "3.方案发起、审核、审批流程3.1十一建资质承接起、审核、审批流程第一步：电脑端打开企业微信...第六步；审批通过，项目修改完后，将需签章资料到科技管理部方案审核岗检查，检查无误后，办公室签章。"
- **合规性**  
  合规
- **依据**  
  《10.施工总承包技术标编制要点指南》要求流程必须覆盖发起、审核、审批、签章全链条，并强调企业微信等数字化工具使用，以提升效率。
- **改进建议**  
  优化流程描述，添加流程图以可视化呈现。

---

## 3 一级危大
- **原文引用**  
  "3.1.2一级危大方案/临电审核/审批流程第六步·审查...方案/批通过，项目修改完后，将临电需签章资料到科技管理部门审案审核岗检查，检查无误核、后，办公室签章。"
- **合规性**  
  不合规
- **不合规原因及依据**  
  未明确专家论证环节，且对超危大方案的授权委托书仅在附件中提及，未融入流程。《10.施工总承包技术标编制要点指南》强调一级危大方案必须包含专家论证步骤(建办质[2018]31号文)，并在流程中整合授权委托书要求。
- **改进建议**  
  在流程第四步后添加"组织专家论证并附授权委托书"步骤，并链接到附件15。

---

## 4 二级施工方案审核、审批流程
- **原文引用**  
  "3.1.3二级施工方案审核、审批流程…第六步：审批通过后，加盖项目部印章，特殊情况(需要集团公司签章)，与科技部方案审核岗联系。"
- **合规性**  
  合规
- **依据**  
  《10.施工总承包技术标编制要点指南》规定二级方案以项目部为主审核，集团辅助，强调印章管理。
- **改进建议**  
  无需修改，但可添加审核时限要求(如3日内完成)。

---

## 5 陕建总资质承接审核流程
- **原文引用**  
  "3.3陕建总资质承接陕建十一建内部审批通过之后，方可发起陕建总审核、审批。3.3.1一级施工组织设计审核、审批流程；…第八步：集团总工程师进行审核，审核完毕之后，选择提交方向至集团生产管理部，自动进入总公司审核、审批流程。"
- **合规性**  
  不合规
- **不合规原因及依据**  
  未提及附件必须包含技术策划和方案研讨纪要，且管理类型选择仅限于C类，未覆盖其他类型。《10.施工总承包技术标编制要点指南》要求陕建总流程附件必须包括内部审批、技术策划、研讨纪要，并明确管理类型选择标准(A/B/C类)。
- **改进建议**  
  补充注意事项：附件需包含技术策划和研讨纪要；扩展管理类型说明，覆盖A/B类项目。

---

## 6 方案编制、审核、审批要点
- **原文引用**  
  "4.方案编制、审核、审批要占41施T组织设计编制...4.2土方开审挖及基坑支护方案编制、审核、核、审批要点一4.11装配式审批混凝土建筑施工方案编制、要点审核、审批要点"
- **合规性**  
  不合规
- **不合规原因及依据**  
  仅列出要点标题，未提供详细编制要点内容，且缺少通用风险辨识与应急措施要点。《10.施工总承包技术标编制要点指南》要求每个分项要点必须详述编制内容、审核重点（如风险辨识、应急处置），并覆盖全过程。
- **改进建议**  
  在每个小节下添加详细要点描述（如风险辨识表、应急流程），参考附件1-11扩展内容。

---

## 7 附件要求
- **原文引用**  
  "5. 附件附件1:施工组织设计编制要点附件2:土方开挖及基坑支护方案编制要点…附件15:超危大方案授权委托书"
- **合规性**  
  合规
- **依据**  
  《10.施工总承包技术标编制要点指南》规定附件必须包括编制要点、规范文件、授权书等，支持分级管理。
- **改进建议**  
  无需修改，但确保附件内容与正文一致性。

---

## 8 前言与目的
- **原文引用**  
  "前言旨在提升施工组织设计/施工方案编制的针对性、规范性、实施指导性，指导项目部施工组织设计/施工方案编制、审核、审批流程；明确项目技术负责人方案编制要点，明确项目经理、二级单位总工、科技管理部、生产管理部、安全管理部审核要点。"
- **合规性**  
  合规
- **依据**  
  《10.施工总承包技术标编制要点指南》强调指南目的必须聚焦规范性、针对性和职责明确。
- **改进建议**  
  无需修改。

---

## 9 编写委员会与审查
- **原文引用**  
  "《施工组织设计/危大方案编制、审核、审批要点指南》编写委员会主编单位：陕西建工第十一建设集团有限公司参编单位：...编委：...审查："
- **合规性**  
  不合规
- **不合规原因及依据**  
  未明确审查流程的时效性和版本控制，且审查人员重复（如正确解联编委又审查）。
- **改进建议**  
  分离编委与审查人员，避免重叠；添加版本控制（如V2022.10.31）和年度审查要求。

---

## 10 整体结构与目录
- **原文引用**  
  "目录1、方案分级…5、附件"
- **合规性**  
  合规
- **依据**  
  《10.施工总承包技术标编制要点指南》要求结构完整。
- **改进建议**  
  无需修改，但可添加索引页码以提升可读性。

---

## 11 独立法人单位流程
- **原文引用**  
  "3.2十一建下属独立法人3.2.1一级施工组织设计审核、审批流程…第六步：审批通过，项目修改完后，独立法人单位总工程师签字，加盖独立法人单位公章。"
- **合规性**  
  不合规
- **不合规原因及依据**  
  未区分独立法人与集团流程的差异，且缺少跨单位协调机制。《10.施工总承包技术标编制要点指南》规定独立法人流程需强调自主审批，但上报集团备案，并设置协调接口。
- **改进建议**  
  添加"审批后上报集团科技管理部备案"步骤。

---

## 12 危险性较大的分部分项工程参照文件
- **原文引用**  
  "(2)施工组织设计/方案编制主要参照发布令：危险性较大的分部分项工程安全管理规定》建办质【2018 31号文】、201837号令】、陕西省【2019】1116号文其他地方政策性文件等。"
- **合规性**  
  合规
- **依据**  
  《10.施工总承包技术标编制要点指南》要求引用核心文件，并允许地方补充。
- **改进建议**  
  无需修改，但更新至最新版本(如2024版隐患判定标准)。

---

## 13 授权委托书格式
- **原文引用**  
  "附件15.超危大方案授权委托书授权委托书本人是陕西建工第十一建设集团有限公司技术负责人程建峰，不能亲自参与..委托人；委托日期："
- **合规性**  
  不合规
- **不合规原因及依据**  
  委托书格式固定于特定人员（程建峰)，未提供通用模板，且缺少双份（论证与验收）。《10.施工总承包技术标编制要点指南》要求授权书模板通用化，覆盖论证与验收两种场景，并留空委托人信息。
- **改进建议**  
  修改为通用模板，添加占位符(如[姓名]、[职称])，并确保双份格式一致。

---

## 评审方法
本评审采用逐条对比方法，对《08施工组织设计/危大方案编制、审核、审批要点指南20221031》的内容与《10.施工总承包技术标编制要点指南》的要求进行一一对应分析。评审过程包括：  
1) 提取关键评估项；  
2) 引用原文；  
3) 判断合规性；  
4) 说明不合规原因及依据；  
5) 提出改进建议。评审基于文档结构、内容完整性、流程规范性和风险管理等维度，确保客观性和全面性。

---

## 评审范围
评审范围覆盖《08施工组织设计/危大方案编制、审核、审批要点指南20221031》的全部核心内容，包括方案分级、编制要求、审核审批流程、编制要点、附件以及前言、编写委员会等辅助部分。总计14个评估项，聚焦于合规性、规范引用、流程完整性和风险控制，不涉及实际项目应用或外部文件验证。

---

## 合规率
- **总评估项**：14项  
- **合规项**：7项  
- **不合规项**：7项  
- **合规率**：50%(7/14)  

---

## 评审结论
总体而言，《08施工组织设计/危大方案编制、审核、审批要点指南20221031》在方案分级、基本流程和附件要求等方面基本符合《10.施工总承包技术标编制要点指南》的标准，但存在规范清单不完整、专家论证环节缺失、审查机制不独立等问题，导致合规率仅为50%。建议根据各评估项的改进意见进行优化修订，以提升指南的规范性和实用性，确保更好地指导施工组织设计和危大方案的管理工作。修订后可重新评审，以验证改进效果。`,
      'doc2': `混凝土结构设计规范

## 第一章 总则

### 1.1 设计目的
为在混凝土结构设计中正确执行国家的技术经济政策，做到安全适用、技术先进、经济合理、确保质量，制定本规范。

### 1.2 适用范围
本规范适用于房屋和一般构筑物的钢筋混凝土、预应力混凝土以及素混凝土承重结构的设计。

### 1.3 编制依据
本规范是在总结我国混凝土结构设计和建设经验，广泛调查研究，认真分析已有科研成果，参考有关国际标准和国外先进标准并在全国范围内征求意见的基础上制定的。

## 设计原则
- **结构安全性**：确保结构在各种荷载作用下具有足够的承载能力
- **结构适用性**：满足正常使用要求，控制变形和裂缝
- **结构耐久性**：在预期使用年限内保持功能
- **经济性要求**：在满足功能要求的前提下，优化材料用量

## 材料要求
- **混凝土强度等级**：根据结构受力特点选择合适等级
- **钢筋规格和性能**：符合国家标准要求
- **外加剂使用规范**：按相关标准执行

## 施工工艺要求
### 5.4.8 关键工况
经讲识基础与地下室阶段关键工况有2项：II区、III区场区道路转换、II区材料周转路线。

#### (1) 关键工况一：II区、III区场区道路转换

**问题分析：**
II区车库基础面积约1.9万m²，基础施工阶段采用62m臂架泵进行混凝土加泵铸，基坑内需留设混凝土浇筑道路及临时材料加工场。

**解决措施：**
通过合理安排施工工序，在基础底板浇筑前预留出车道和材料堆放区域，确保施工顺利进行。优化材料运输路线，减少对基坑内施工的影响。

**技术要求：**
- 车道宽度不少于6米
- 承载力满足重型车辆通行
- 排水设施完善
- 安全防护到位

**质量控制：**
- 严格按照设计要求执行
- 加强现场监督检查
- 做好施工记录和验收`,
      // 可以继续添加更多文档内容
    }
    return contents[docId] || '文档内容加载中...'
  }
  
  // 格式化文档内容
  const formatDocumentContent = (content: string): string => {
    return content
      // 处理标题
      .replace(/^#\s+(.+)$/gm, '<h1 class="doc-main-title">$1</h1>')
      .replace(/^##\s+(.+)$/gm, '<h2 class="doc-section-title">$1</h2>')
      .replace(/^###\s+(.+)$/gm, '<h3 class="doc-subsection-title">$1</h3>')
      .replace(/^####\s+(.+)$/gm, '<h4 class="doc-item-title">$1</h4>')
      
      // 处理粗体文本
      .replace(/\*\*(.+?)\*\*/g, '<strong class="doc-bold">$1</strong>')
      
      // 处理分隔线
      .replace(/^---$/gm, '<hr class="doc-divider">')
      
      // 处理列表 - 修复列表处理逻辑
      .replace(/^-\s+(.+)$/gm, '<li class="doc-list-item">$1</li>')
      .replace(/(<li class="doc-list-item">.*<\/li>)/gs, '<ul class="doc-list">$1</ul>')
      
      // 处理段落 - 改进段落处理
      .replace(/\n\n+/g, '</p><p class="doc-paragraph">')
      .replace(/\n/g, '<br>')
      .replace(/^/, '<p class="doc-paragraph">')
      .replace(/$/, '</p>')
      
      // 清理多余的标签
      .replace(/<p class="doc-paragraph"><\/p>/g, '')
      .replace(/<p class="doc-paragraph"><br><\/p>/g, '')
      .replace(/<p class="doc-paragraph"><\/p>/g, '')
  }
  
  
  
  const clearSelections = () => {
    ElMessageBox.confirm(
      '确定要清空所有选择吗？',
      '确认操作',
      {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }
    ).then(() => {
      uploadedFiles.value = []
      selectedSolutionTypes.value = []
      selectedKnowledgeCategory.value = ''
      selectedDocuments.value = []
      currentCategoryDocuments.value = []
      analysisResult.value = null
      ElMessage.success('已清空所有选择')
    }).catch(() => {
      // 用户取消
    })
  }
  
  // 分析相关方法
  const runAnalysis = async () => {
    if (!canRunAnalysis.value) {
      ElMessage.error('请完成所有选择后再进行分析')
      return
    }
    
    isAnalyzing.value = true
    
    try {
      // 模拟 API 调用和分析过程
      await simulateAnalysisProcess()
      
      // 生成模拟分析结果
      analysisResult.value = generateMockAnalysisResult()
      
      // 生成文档内容并添加高亮
      generateDocumentWithHighlights()
      
      ElMessage.success('审核分析完成！发现的问题已高亮显示')
    } catch (error) {
      console.error('分析失败:', error)
      ElMessage.error('分析失败，请稍后再试')
    } finally {
      isAnalyzing.value = false
    }
  }

  // 模拟分析过程
  const simulateAnalysisProcess = async () => {
    const steps = [
      '正在解析文档内容...',
      '正在检查规范性要求...',
      '正在对比标准规范...',
      '正在识别潜在问题...',
      '正在生成审核报告...'
    ]
    
    for (let i = 0; i < steps.length; i++) {
      currentLoadingStep.value = steps[i]
      await new Promise(resolve => setTimeout(resolve, 600))
      // 显示当前步骤
      ElMessage.info({
        message: steps[i],
        duration: 800,
        showClose: false
      })
    }
  }

  // 生成带高亮的文档内容
  const generateDocumentWithHighlights = () => {
    // 如果没有选择文档，自动选择第一个上传的文件
    if (!selectedDocumentForView.value && uploadedFiles.value.length > 0) {
      const firstFile = uploadedFiles.value[0]
      selectedDocumentForView.value = {
        id: firstFile.id,
        name: firstFile.name,
        type: firstFile.type,
        size: firstFile.size,
        uploadDate: new Date().toISOString(),
        categoryPath: []
      }
    }
    
    if (!selectedDocumentForView.value) return
    
    // 清空之前的批注
    annotations.value = []
    
    // 根据分析结果生成批注和高亮
    if (analysisResult.value) {
      analysisResult.value.documents.forEach(doc => {
        if (doc.issues && doc.issues.length > 0) {
          doc.issues.forEach((issue, index) => {
            if (issue.annotations && issue.annotations.length > 0) {
              issue.annotations.forEach(ann => {
                const newAnnotation: Annotation = {
                  id: `issue-${doc.title}-${index}-${Date.now()}`,
                  content: issue.description,
                  position: {
                    top: 100 + Math.random() * 200,
                    left: 50 + Math.random() * 300
                  },
                  selectedText: ann.content,
                  suggestion: issue.suggestion,
                  visible: false
                }
                annotations.value.push(newAnnotation)
              })
            }
          })
        }
      })
    }
    
    // 在文档内容中添加高亮标记
    setTimeout(() => {
      highlightIssuesInDocument()
    }, 100)
  }

  // 在文档内容中高亮问题
  const highlightIssuesInDocument = () => {
    if (!documentViewerRef.value || !analysisResult.value) return
    
    const documentText = documentViewerRef.value.querySelector('.document-text')
    if (!documentText) return
    
    // 根据问题类型添加不同的高亮样式
    analysisResult.value.documents.forEach(doc => {
      if (doc.issues && doc.issues.length > 0) {
        doc.issues.forEach(issue => {
          if (issue.annotations && issue.annotations.length > 0) {
            issue.annotations.forEach(ann => {
              // 查找文档中对应的文本并高亮
              const textNodes = documentText.childNodes
              textNodes.forEach(node => {
                if (node.nodeType === Node.TEXT_NODE && node.textContent) {
                  const text = node.textContent
                  if (text.includes(ann.content)) {
                    // 创建高亮元素
                    const highlightSpan = document.createElement('span')
                    highlightSpan.className = `issue-highlight issue-${issue.type} issue-${issue.severity}`
                    highlightSpan.setAttribute('data-issue-type', issue.type)
                    highlightSpan.setAttribute('data-issue-severity', issue.severity)
                    highlightSpan.title = `${issue.description}\n\n建议：${issue.suggestion || '无'}`
                    
                    // 替换文本
                    const regex = new RegExp(`(${ann.content})`, 'g')
                    const highlightedText = text.replace(regex, `<span class="issue-highlight issue-${issue.type} issue-${issue.severity}" data-issue-type="${issue.type}" data-issue-severity="${issue.severity}" title="${issue.description}\n\n建议：${issue.suggestion || '无'}">$1</span>`)
                    
                    if (highlightedText !== text) {
                      const tempDiv = document.createElement('div')
                      tempDiv.innerHTML = highlightedText
                      node.parentNode?.replaceChild(tempDiv, node)
                    }
                  }
                }
              })
            })
          }
        })
      }
    })
  }

  // 获取当前文档的问题列表
  const getCurrentDocumentIssues = () => {
    if (!selectedDocumentForView.value || !analysisResult.value) return []
    
    const currentDoc = analysisResult.value.documents.find(
      doc => doc.title === selectedDocumentForView.value?.name
    )
    
    return currentDoc?.issues || []
  }

  // 获取问题类型标签
  const getIssueTypeLabel = (type: string) => {
    const typeLabels: Record<string, string> = {
      'missing': '缺失内容',
      'error': '不合规项',
      'warning': '格式警告',
      'info': '信息提示',
      'pass': '合规项'
    }
    return typeLabels[type] || type
  }

  // 获取严重程度标签
  const getSeverityLabel = (severity: string) => {
    const severityLabels: Record<string, string> = {
      'high': '高',
      'medium': '中',
      'low': '低'
    }
    return severityLabels[severity] || severity
  }

  // 选择第一个文档进行查看
  const selectFirstDocument = () => {
    if (uploadedFiles.value.length > 0) {
      const firstFile = uploadedFiles.value[0]
      selectedDocumentForView.value = {
        id: firstFile.id,
        name: firstFile.name,
        type: firstFile.type,
        size: firstFile.size,
        uploadDate: new Date().toISOString(),
        categoryPath: []
      }
    }
  }

  // 下载审核报告
  const downloadReport = async () => {
    if (!analysisResult.value || !selectedDocumentForView.value) {
      ElMessage.warning('请先选择文档并完成审核分析')
      return
    }

    try {
      isDownloading.value = true
      
      // 生成报告内容
      const reportContent = generateReportContent()
      
      // 创建Blob对象
      const blob = new Blob([reportContent], { type: 'text/plain;charset=utf-8' })
      
      // 创建下载链接
      const url = window.URL.createObjectURL(blob)
      const link = document.createElement('a')
      link.href = url
      link.download = `${selectedDocumentForView.value.name}_审核报告_${new Date().toISOString().split('T')[0]}.txt`
      
      // 触发下载
      document.body.appendChild(link)
      link.click()
      document.body.removeChild(link)
      
      // 清理URL
      window.URL.revokeObjectURL(url)
      
      ElMessage.success('报告下载成功')
    } catch (error) {
      console.error('下载报告失败:', error)
      ElMessage.error('下载报告失败，请重试')
    } finally {
      isDownloading.value = false
    }
  }

  // 生成报告内容
  const generateReportContent = (): string => {
    if (!analysisResult.value || !selectedDocumentForView.value) return ''
    
    const doc = selectedDocumentForView.value
    const result = analysisResult.value
    
    let content = `方案审核报告\n`
    content += `=${'='.repeat(50)}\n\n`
    content += `文档名称：${doc.name}\n`
    content += `审核时间：${new Date().toLocaleString('zh-CN')}\n`
    content += `文档类型：${doc.type}\n\n`
    
    content += `审核概览\n`
    content += `-${'-'.repeat(30)}\n`
    content += `总评估项：${result.totalEvaluationItems}\n`
    content += `合规项：${result.compliantItems}\n`
    content += `不合规项：${result.nonCompliantItems}\n`
    content += `合规率：${result.complianceRate}%\n\n`
    
    // 添加问题详情
    const issues = getCurrentDocumentIssues()
    if (issues.length > 0) {
      content += `问题详情\n`
      content += `-${'-'.repeat(30)}\n`
      issues.forEach((issue, index) => {
        content += `${index + 1}. ${issue.title}\n`
        content += `   类型：${getIssueTypeLabel(issue.type)}\n`
        content += `   严重程度：${getSeverityLabel(issue.severity)}\n`
        content += `   描述：${issue.description}\n`
        if (issue.suggestion) {
          content += `   改进建议：${issue.suggestion}\n`
        }
        content += `\n`
      })
    }
    
    content += `\n报告生成时间：${new Date().toLocaleString('zh-CN')}\n`
    content += `审核系统：方案审核助手\n`
    
    return content
  }


  
  const generateMockAnalysisResult = (): AnalysisResult => {
    // 根据评审报告生成14个评估项的问题
    const evaluationIssues: AnalysisIssue[] = [
      // 1. 编制 - 不合规
      {
        type: 'error',
        severity: 'high',
        title: '编制',
        serialNumber: 1,
        description: '方案编制参照规范及标准',
        suggestion: '补充完整规范清单(如GB50010-2010《混凝土结构设计规范》、JGJ162等核心规范)，并明确禁止随意增减',
        annotations: [
          {
            position: '2.1方案编制参照规范及标准',
            content: '方案编制参照规范及标准'
          }
        ]
      },
      // 2. 方案发起 - 合规
      {
        type: 'pass',
        severity: 'low',
        title: '方案发起',
        serialNumber: 2,
        description: '流程完整，符合要求',
        suggestion: '优化流程描述，添加流程图以可视化呈现',
        annotations: [
          {
            position: '3.方案发起、审核、审批流程',
            content: '流程完整，符合要求'
          }
        ]
      },
      // 3. 一级危大 - 不合规
      {
        type: 'error',
        severity: 'high',
        title: '未包含计算书及相关施工图纸',
        serialNumber: 3,
        description: '方案中提到了“验算软件”，但正文中未见具体的计算书内容',
        suggestion: '补充完整的计算书，包括但不限于：荷载计算（恒载、活载、风荷载）,立杆稳定性验算（含地基承载力或楼板承载力验算）,水平杆、斜杆承载力验算,抗倾覆验算,关键节点验算（如可调托座、连接盘）',
        annotations: [
          {
            position: '3.1.2一级危大方案审核流程',
            content: '一级危大方案审核流程'
          }
        ]
      },
      // 4. 二级施工方案 - 合规
      {
        type: 'pass',
        severity: 'low',
        title: '二级施工方案',
        serialNumber: 4,
        description: '流程完整，符合要求',
        suggestion: '无需修改，但可添加审核时限要求(如3日内完成)',
        annotations: [
          {
            position: '3.1.3二级施工方案审核、审批流程',
            content: '流程完整，符合要求'
          }
        ]
      },
      // 5. 陕建总资质承接 - 不合规
      {
        type: 'error',
        severity: 'high',
        title: '陕建总资质承接',
        serialNumber: 5,
        description: '陕建总资质承接审核流程',
        suggestion: '补充注意事项：附件需包含技术策划和研讨纪要；扩展管理类型说明，覆盖A/B类项目',
        annotations: [
          {
            position: '3.3陕建总资质承接',
            content: '陕建总资质承接审核流程'
          }
        ]
      },
      // 6. 方案编制要点 - 不合规
      {
        type: 'error',
        severity: 'medium',
        title: '方案编制要点',
        serialNumber: 6,
        description: '方案编制要点',
        suggestion: '在每个小节下添加详细要点描述（如风险辨识表、应急流程），参考附件1-11扩展内容',
        annotations: [
          {
            position: '4.方案编制、审核、审批要点',
            content: '方案编制要点'
          }
        ]
      },
      // 7. 附件要求 - 合规
      {
        type: 'pass',
        severity: 'low',
        title: '附件要求',
        serialNumber: 7,
        description: '附件要求',
        suggestion: '无需修改，但确保附件内容与正文一致性',
        annotations: [
          {
            position: '5.附件',
            content: '附件要求'
          }
        ]
      },
      // 8. 前言与目的 - 合规
      {
        type: 'pass',
        severity: 'low',
        title: '前言与目的明确，聚焦规范性、针对性和职责明确',
        serialNumber: 8,
        description: '前言与目的',
        suggestion: '无需修改',
        annotations: [
          {
            position: '前言',
            content: '前言与目的'
          }
        ]
      },
      // 9. 编写委员会与审查 - 不合规
      {
        type: 'error',
        severity: 'medium',
        title: '编写委员会与审查',
        serialNumber: 9,
        description: '编写委员会与审查',
        suggestion: '分离编委与审查人员，避免重叠；添加版本控制（如V2022.10.31）和年度审查要求',
        annotations: [
          {
            position: '编写委员会与审查',
            content: '编写委员会与审查'
          }
        ]
      },
      // 10. 整体结构与目录 - 合规
      {
        type: 'pass',
        severity: 'low',
        title: '整体结构与目录',
        serialNumber: 10,
        description: '整体结构与目录',
        suggestion: '无需修改，但可添加索引页码以提升可读性',
        annotations: [
          {
            position: '目录',
            content: '整体结构与目录'
          }
        ]
      },
      // 11. 独立法人单位流程 - 不合规
      {
        type: 'error',
        severity: 'medium',
        title: '独立法人单位流程',
        serialNumber: 11,
        description: '独立法人单位流程',
        suggestion: '添加"审批后上报集团科技管理部备案"步骤',
        annotations: [
          {
            position: '3.2十一建下属独立法人',
            content: '独立法人单位流程'
          }
        ]
      },
      // 12. 危险性较大的分部分项工程参照文件 - 合规
      {
        type: 'pass',
        severity: 'low',
        title: '危险性较大的分部分项工程参照文件',
        serialNumber: 12,
        description: '危险性较大的分部分项工程参照文件',
        suggestion: '无需修改，但更新至最新版本(如2024版隐患判定标准)',
        annotations: [
          {
            position: '危险性较大的分部分项工程参照文件',
            content: '危险性较大的分部分项工程参照文件'
          }
        ]
      },
      // 13. 授权委托书格式 - 不合规
      {
        type: 'error',
        severity: 'medium',
        title: '委托书格式',
        serialNumber: 13,
        description: '授权委托书',
        suggestion: '修改为通用模板，添加占位符(如[姓名]、[职称])，并确保双份格式一致',
        annotations: [
          {
            position: '附件15.超危大方案授权委托书',
            content: '授权委托书'
          }
        ]
      },
      // 14. 评审方法 - 合规
      {
        type: 'pass',
        severity: 'low',
        title: '评审方法',
        serialNumber: 14,
        description: '评审方法',
        suggestion: '无需修改',
        annotations: [
          {
            position: '评审方法',
            content: '评审方法'
          }
        ]
      }
    ]

    const documents: AnalysisDocument[] = uploadedFiles.value.map((file) => {
      // 根据文件类型分配问题
      const isHighFormwork = file.name.includes('高大支模') || file.name.includes('高支模')
      
             if (isHighFormwork) {
         // 高大支模专项施工方案显示所有14个评估项
         return {
           id: file.id,
           name: file.name,
           title: file.name,
           status: 'reviewed',
           issues: evaluationIssues,
           categoryPath: []
         }
       } else {
         // 其他类型文件显示部分问题
         const randomIssues = evaluationIssues
           .sort(() => Math.random() - 0.5)
           .slice(0, Math.floor(Math.random() * 5) + 3)
         
         return {
           id: file.id,
           name: file.name,
           title: file.name,
           status: 'reviewed',
           issues: randomIssues,
           categoryPath: []
         }
       }
     })
    
    const passedDocuments = documents.filter(d => d.status === 'pass').length
    const warningDocuments = documents.filter(d => d.status === 'warning').length
    const errorDocuments = documents.filter(d => d.status === 'error').length
    
    return {
      totalDocuments: documents.length,
      passedDocuments,
      warningDocuments,
      errorDocuments,
      documents,
      totalEvaluationItems: 14,
      compliantItems: 7,
      nonCompliantItems: 7,
      complianceRate: 50
    }
  }
  
  
  
  // 初始化
  onMounted(() => {
    console.log('文档助手页面已加载')
    
    // 企业知识库分类数据与企业知识库数据保持一致
    // 数据来源于企业知识库模块页面，确保数据同步
    console.log('企业知识库数据已加载，分类与知识库数据一致')
  })
  </script>
  
  <style scoped>
  .doc-assistant {
    font-family: 'Inter', 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
  }
  
  .assistant-container {
    display: flex;
    height: calc(100vh - 48px);
    gap: 24px;
    max-width: 1600px;
    margin: 0 auto;
  }
  
  /* 左侧面板 */
  .left-panel {
    width: 420px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(18px);
    border-radius: 20px;
    box-shadow: 0 4px 24px 0 rgba(80, 100, 200, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: calc(100vh - 48px);
  }
  
  /* 上传区域 */
  .upload-section {
    padding: 28px;
    border-bottom: 1px solid rgba(235, 238, 245, 0.6);
  }
  
  .section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    letter-spacing: -0.01em;
  }
  
  .section-title .el-icon {
    font-size: 20px;
    color: #5b7cff;
  }
  
  .upload-area {
    border: 2px dashed rgba(91, 124, 255, 0.3);
    border-radius: 16px;
    padding: 24px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, rgba(91, 124, 255, 0.03) 0%, rgba(166, 133, 255, 0.03) 100%);
    position: relative;
    overflow: hidden;
  }
  
  .upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 48%, rgba(91, 124, 255, 0.05) 50%, transparent 52%);
    opacity: 0;
    transition: opacity 0.3s;
  }
  
  .upload-area:hover,
  .upload-area.is-dragover {
    border-color: #5b7cff;
    background: linear-gradient(135deg, rgba(91, 124, 255, 0.08) 0%, rgba(166, 133, 255, 0.08) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(91, 124, 255, 0.15);
  }
  
  .upload-area:hover::before {
    opacity: 1;
  }
  
  .upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 1;
  }
  
  .upload-icon {
    color: #5b7cff;
    transition: all 0.3s;
  }
  
  .upload-area:hover .upload-icon {
    transform: scale(1.1);
    color: #a685ff;
  }
  
  .upload-title {
    font-size: 18px;
    color: #2c3e50;
    font-weight: 600;
    letter-spacing: -0.01em;
  }
  
  .upload-desc {
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
  }
  
  /* 已上传文件 */
  .uploaded-files {
    margin-top: 20px;
    max-height: 240px;
    overflow-y: auto;
  }
  
  .file-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    margin-bottom: 10px;
    border: 1px solid rgba(91, 124, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .file-item:hover {
    background: rgba(91, 124, 255, 0.05);
    border-color: rgba(91, 124, 255, 0.2);
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(91, 124, 255, 0.1);
  }
  
  .file-icon {
    color: #5b7cff;
    transition: color 0.3s;
  }
  
  .file-item:hover .file-icon {
    color: #a685ff;
  }
  
  .file-info {
    flex: 1;
    min-width: 0;
  }
  
  .file-name {
    font-size: 15px;
    color: #2c3e50;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
  }
  
  .file-size {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
    font-weight: 500;
  }
  
  .file-actions {
    display: flex;
    gap: 6px;
  }
  
  /* 配置区域 */
  .config-section {
    padding: 28px;
    border-bottom: 1px solid rgba(235, 238, 245, 0.6);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .config-section:hover {
    background: rgba(91, 124, 255, 0.02);
  }
  
  .config-section:last-of-type {
    border-bottom: none;
  }
  
  .form-tip {
    font-size: 13px;
    color: #64748b;
    margin-top: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(91, 124, 255, 0.05) 0%, rgba(166, 133, 255, 0.05) 100%);
    border-radius: 10px;
    border: 1px solid rgba(91, 124, 255, 0.1);
    font-weight: 500;
  }
  
  /* 子配置项样式 */
  .sub-config-item {
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(247, 250, 252, 0.9) 100%);
    border-radius: 16px;
    border: 1px solid rgba(91, 124, 255, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
  }
  
  .sub-config-item:last-child {
    margin-bottom: 0;
  }
  
  .sub-config-item:hover {
    border-color: rgba(91, 124, 255, 0.2);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 255, 0.95) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(91, 124, 255, 0.1);
  }
  
  .sub-config-item.disabled {
    opacity: 0.5;
    background: linear-gradient(135deg, rgba(245, 247, 250, 0.8) 0%, rgba(241, 245, 249, 0.8) 100%);
    transform: none;
  }
  
  .sub-config-item.disabled:hover {
    border-color: rgba(235, 238, 245, 0.6);
    background: linear-gradient(135deg, rgba(245, 247, 250, 0.8) 0%, rgba(241, 245, 249, 0.8) 100%);
    transform: none;
    box-shadow: none;
  }
  
  .sub-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    letter-spacing: -0.01em;
  }
  
  .sub-title .el-icon {
    font-size: 18px;
    color: #5b7cff;
  }
  
  .category-info {
    font-size: 12px;
    color: #64748b;
    font-weight: 400;
    margin-left: 8px;
  }
  
  
  
  /* 文档列表样式 */
  .document-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px 0;
  }
  
  .document-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid rgba(91, 124, 255, 0.1);
    border-radius: 8px;
    transition: all 0.3s;
  }
  
  .document-item:hover {
    border-color: rgba(91, 124, 255, 0.2);
    background: rgba(91, 124, 255, 0.02);
  }
  
  .document-item:last-child {
    margin-bottom: 0;
  }
  
  .document-checkbox {
    flex: 1;
    min-width: 0;
  }
  
  .view-document-btn {
    margin-left: 8px;
    color: #5b7cff !important;
    flex-shrink: 0;
  }
  
  .view-document-btn:hover {
    background: rgba(91, 124, 255, 0.1) !important;
  }
  
  .document-checkbox :deep(.el-checkbox__label) {
    width: 100%;
    padding-left: 8px;
  }
  
  .document-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  
  .document-name {
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
    line-height: 1.4;
  }
  
  .document-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #64748b;
  }
  
  .document-size,
  .document-date {
    font-weight: 500;
  }
  
  /* 选择器样式增强 */
  .config-section :deep(.el-select) {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .config-section :deep(.el-select .el-input__wrapper) {
    border-radius: 12px;
    border: 1px solid rgba(91, 124, 255, 0.15);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(91, 124, 255, 0.05);
  }
  
  .config-section :deep(.el-select .el-input__wrapper:hover) {
    border-color: rgba(91, 124, 255, 0.3);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 16px rgba(91, 124, 255, 0.1);
    transform: translateY(-1px);
  }
  
  .config-section :deep(.el-select.is-focused .el-input__wrapper) {
    border-color: #5b7cff;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 3px rgba(91, 124, 255, 0.1);
  }
  
  .config-section :deep(.el-input__inner) {
    color: #2c3e50;
    font-weight: 500;
    font-size: 15px;
  }
  
  /* 多选标签样式 */
  .config-section :deep(.el-tag) {
    border-radius: 18px;
    border: none;
    background: linear-gradient(135deg, #5b7cff 0%, #a685ff 100%);
    color: white;
    font-weight: 600;
    font-size: 13px;
    margin-right: 8px;
    margin-bottom: 4px;
    padding: 6px 12px;
    box-shadow: 0 2px 8px rgba(91, 124, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .config-section :deep(.el-tag:hover) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(91, 124, 255, 0.3);
  }
  
  .config-section :deep(.el-tag .el-icon) {
    color: rgba(255, 255, 255, 0.9);
    transition: all 0.3s;
  }
  
  .config-section :deep(.el-tag .el-icon:hover) {
    color: white;
    transform: scale(1.1);
  }
  
  /* 树状下拉框样式 */
  .config-section :deep(.el-tree-select) {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .config-section :deep(.el-tree-select .el-input__wrapper) {
    border-radius: 12px;
    border: 1px solid rgba(91, 124, 255, 0.15);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(91, 124, 255, 0.05);
  }
  
  .config-section :deep(.el-tree-select .el-input__wrapper:hover) {
    border-color: rgba(91, 124, 255, 0.3);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 16px rgba(91, 124, 255, 0.1);
    transform: translateY(-1px);
  }
  
  .config-section :deep(.el-tree-select.is-focused .el-input__wrapper) {
    border-color: #5b7cff;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 3px rgba(91, 124, 255, 0.1);
  }
  
  .config-section :deep(.el-tree-select .el-input__inner) {
    color: #2c3e50;
    font-weight: 500;
    font-size: 15px;
  }
  
  /* 树状下拉框下拉面板样式 */
  .config-section :deep(.el-tree-select__popper) {
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(91, 124, 255, 0.15);
    border: 1px solid rgba(91, 124, 255, 0.1);
  }
  
  .config-section :deep(.el-tree-select__popper .el-tree-node__content) {
    padding: 8px 12px;
    border-radius: 6px;
    margin: 2px 4px;
    transition: all 0.3s;
  }
  
  .config-section :deep(.el-tree-select__popper .el-tree-node__content:hover) {
    background: rgba(91, 124, 255, 0.08);
  }
  
  .config-section :deep(.el-tree-select__popper .el-tree-node.is-current > .el-tree-node__content) {
    background: rgba(91, 124, 255, 0.15);
    color: #5b7cff;
    font-weight: 600;
  }
  
  /* 操作按钮 */
  .action-buttons {
    padding: 28px;
    display: flex;
    gap: 16px;
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.8) 0%, rgba(241, 245, 249, 0.8) 100%);
    border-radius: 0 0 20px 20px;
    flex-shrink: 0;
    margin-top: auto;
  }
  
  .action-buttons :deep(.el-button) {
    flex: 1;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    padding: 14px 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: -0.01em;
  }
  
  .action-buttons :deep(.el-button--primary) {
    background: linear-gradient(135deg, #5b7cff 0%, #a685ff 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 16px rgba(91, 124, 255, 0.3);
  }
  
  .action-buttons :deep(.el-button--primary:hover) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(91, 124, 255, 0.4);
  }
  
  .action-buttons :deep(.el-button:not(.el-button--primary)) {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(91, 124, 255, 0.2);
    color: #5b7cff;
    backdrop-filter: blur(10px);
  }
  
  .action-buttons :deep(.el-button:not(.el-button--primary):hover) {
    background: rgba(91, 124, 255, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(91, 124, 255, 0.15);
  }
  
  /* 右侧面板 */
  .right-panel {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(18px);
    border-radius: 20px;
    box-shadow: 0 4px 24px 0 rgba(80, 100, 200, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  
  .right-panel .panel-header {
    padding: 32px 28px 24px;
    background: rgba(255, 255, 255, 0.9);
    color: #2c3e50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(235, 238, 245, 0.6);
  }
  
  .right-panel .panel-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
  }
  
  .header-actions {
    display: flex;
    gap: 12px;
  }
  
  /* 审核结果摘要样式 */
  .audit-summary {
    overflow-y: auto;
    background: linear-gradient(135deg, rgba(91, 124, 255, 0.02) 0%, rgba(166, 133, 255, 0.02) 100%);
    border: 1px solid rgba(91, 124, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  }

  .summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(91, 124, 255, 0.1);
  }

  .summary-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .summary-header h4::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #5b7cff, #a685ff);
    border-radius: 2px;
  }

  .compliance-rate {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }
  
  .compliance-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
  }
  
  .compliance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }
  
  .compliance-item .label {
    color: #606266;
    font-weight: 500;
  }
  
  .compliance-item .value {
    font-weight: 600;
  }
  
  .compliance-item .value.compliant {
    color: #67c23a;
  }
  
  .compliance-item .value.non-compliant {
    color: #f56c6c;
  }
  

  .rate-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(91, 124, 255, 0.1) 0%, rgba(166, 133, 255, 0.1) 100%);
    border: 2px solid rgba(91, 124, 255, 0.2);
    transition: all 0.3s ease;
  }

  .rate-circle:hover {
    transform: scale(1.05);
    border-color: rgba(91, 124, 255, 0.4);
  }

  .rate-number {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
    margin-bottom: 4px;
  }

  .rate-label {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
  }

  .summary-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 24px 0;
  }

  .stat-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
  }

  .stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stat-color);
  }

  .stat-item.total::before {
    --stat-color: #007bff;
  }

  .stat-item.pass::before {
    --stat-color: #28a745;
  }

  .stat-item.warning::before {
    --stat-color: #ffc107;
  }

  .stat-item.error::before {
    --stat-color: #dc3545;
  }

  .stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
  }

  .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    flex-shrink: 0;
  }

  .stat-item.total .stat-icon {
    background: linear-gradient(135deg, #007bff, #0056b3);
  }

  .stat-item.pass .stat-icon {
    background: linear-gradient(135deg, #28a745, #20c997);
  }

  .stat-item.warning .stat-icon {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
  }

  .stat-item.error .stat-icon {
    background: linear-gradient(135deg, #dc3545, #e83e8c);
  }

  .stat-content {
    flex: 1;
  }

  .stat-number {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
    margin-bottom: 4px;
  }

  .stat-label {
    font-size: 13px;
    color: #6c757d;
    font-weight: 500;
  }

  .issues-list {
    margin-top: 24px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    overflow: hidden;
  }

  .issues-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
  }

  .issues-header h5 {
    margin: 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
  }

  .issues-count {
    background: #5b7cff;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
  }

  .issue-item {
    padding: 20px;
    border-bottom: 1px solid #f1f3f4;
    transition: all 0.3s ease;
    position: relative;
  }

  .issue-item:last-child {
    border-bottom: none;
  }

  .issue-item:hover {
    background: #f8f9fa;
    transform: translateX(4px);
  }

  .issue-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
  }

  .issue-title-section {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
  }

  .issue-serial-number {
    background: #5b7cff;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
  }

  .issue-title {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.4;
  }

  .issue-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }

  .issue-type {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .issue-type.type-missing {
    background: rgba(255, 193, 7, 0.15);
    color: #856404;
    border: 1px solid rgba(255, 193, 7, 0.3);
  }

  .issue-type.type-error {
    background: rgba(220, 53, 69, 0.15);
    color: #721c24;
    border: 1px solid rgba(220, 53, 69, 0.3);
  }

  .issue-type.type-warning {
    background: rgba(253, 126, 20, 0.15);
    color: #856404;
    border: 1px solid rgba(253, 126, 20, 0.3);
  }

  .issue-severity {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .issue-severity.severity-high {
    background: rgba(220, 53, 69, 0.2);
    color: #721c24;
  }

  .issue-severity.severity-medium {
    background: rgba(255, 193, 7, 0.2);
    color: #856404;
  }

  .issue-severity.severity-low {
    background: rgba(40, 167, 69, 0.2);
    color: #155724;
  }

  .issue-description {
    color: #2c3e50;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
    font-weight: 500;
  }

  .issue-suggestion {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid #5b7cff;
    color: #495057;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 8px;
  }

  .issue-suggestion strong {
    color: #5b7cff;
    font-weight: 600;
  }

  .issue-location {
    color: #6c757d;
    font-size: 12px;
    margin-top: 8px;
    padding: 8px 12px;
    background: #e9ecef;
    border-radius: 6px;
    display: inline-block;
  }

  .issue-location strong {
    color: #495057;
    font-weight: 600;
  }

  /* 审核概览样式 */
  .audit-overview {
    padding: 40px 20px;
    text-align: center;
    background: linear-gradient(135deg, rgba(91, 124, 255, 0.05) 0%, rgba(166, 133, 255, 0.05) 100%);
    border-radius: 16px;
    border: 1px solid rgba(91, 124, 255, 0.1);
  }

  .overview-header {
    margin-bottom: 32px;
  }

  .overview-header h4 {
    font-size: 24px;
    color: #2c3e50;
    margin-bottom: 8px;
    font-weight: 600;
  }

  .overview-header p {
    color: #6c757d;
    font-size: 16px;
    margin: 0;
  }

  .overview-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 32px;
  }

  .stat-card {
    background: white;
    padding: 24px 16px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
  }

  .stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--stat-color);
  }

  .stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  }

  .stat-card.pass::before {
    --stat-color: #28a745;
  }

  .stat-card.warning::before {
    --stat-color: #ffc107;
  }

  .stat-card.error::before {
    --stat-color: #dc3545;
  }

  .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 24px;
    color: white;
  }

  .stat-card.pass .stat-icon {
    background: linear-gradient(135deg, #28a745, #20c997);
  }

  .stat-card.warning .stat-icon {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
  }

  .stat-card.error .stat-icon {
    background: linear-gradient(135deg, #dc3545, #e83e8c);
  }

  .stat-content {
    text-align: center;
  }

  .stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
    margin-bottom: 8px;
  }

  .stat-label {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
  }

  .overview-actions {
    margin-top: 24px;
  }

  .overview-actions .el-button {
    background: linear-gradient(135deg, #5b7cff 0%, #a685ff 100%);
    border: none;
    color: white;
    font-weight: 600;
    padding: 12px 32px;
    border-radius: 8px;
    transition: all 0.3s ease;
  }

  .overview-actions .el-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(91, 124, 255, 0.3);
  }

  /* 文档内容显示样式 */
  .document-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  
  .document-header {
    padding: 20px 28px;
    border-bottom: 1px solid rgba(235, 238, 245, 0.6);
    background: rgba(248, 250, 252, 0.5);
  }
  
  .document-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
  }
  
  .document-title .el-icon {
    color: #5b7cff;
    font-size: 20px;
  }
  
  .document-info-bar {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #64748b;
  }
  
  .document-viewer {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    position: relative;
    user-select: text;
  }
  
  .document-text {
    line-height: 1.8;
    color: #2c3e50;
    font-size: 14px;
    padding: 24px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  }
  
  .document-text :deep(.doc-main-title) {
    font-size: 24px;
    font-weight: 700;
    color: #1a202c;
    margin: 0 0 24px 0;
    padding: 16px 0;
    text-align: center;
    border-bottom: 3px solid #5b7cff;
    position: relative;
  }
  
  .document-text :deep(.doc-main-title::before) {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -3px;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(135deg, #5b7cff, #a685ff);
  }
  
  .document-text :deep(.doc-section-title) {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin: 32px 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #5b7cff;
    position: relative;
  }
  
  .document-text :deep(.doc-section-title::before) {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 40px;
    height: 2px;
    background: linear-gradient(135deg, #5b7cff, #a685ff);
  }
  
  .document-text :deep(.doc-subsection-title) {
    font-size: 16px;
    font-weight: 600;
    color: #34495e;
    margin: 24px 0 12px 0;
    padding-left: 16px;
    border-left: 3px solid #ffc107;
  }
  
  .document-text :deep(.doc-item-title) {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin: 20px 0 12px 0;
    padding-left: 12px;
    border-left: 2px solid #28a745;
  }
  
  .document-text :deep(.doc-paragraph) {
    margin: 12px 0;
    line-height: 1.8;
    color: #495057;
  }
  
  .document-text :deep(.doc-bold) {
    color: #5b7cff;
    font-weight: 600;
  }
  
  .document-text :deep(.doc-divider) {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e9ecef, transparent);
    margin: 24px 0;
  }
  
  .document-text :deep(.doc-list) {
    margin: 12px 0;
    padding-left: 20px;
  }
  
  .document-text :deep(.doc-list-item) {
    margin: 8px 0;
    line-height: 1.6;
    color: #495057;
    position: relative;
  }
  
  .document-text :deep(.doc-list-item::before) {
    content: '•';
    color: #5b7cff;
    font-weight: bold;
    position: absolute;
    left: -16px;
  }
  
  /* 问题高亮样式 */
  .document-text :deep(.issue-highlight) {
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    font-weight: 500;
    text-decoration: underline;
    text-decoration-style: wavy;
  }
  
  .document-text :deep(.issue-highlight.issue-missing) {
    background: rgba(255, 193, 7, 0.15);
    border-bottom: 2px solid #ffc107;
    color: #856404;
    text-decoration-color: #ffc107;
  }
  
  .document-text :deep(.issue-highlight.issue-error) {
    background: rgba(220, 53, 69, 0.15);
    border-bottom: 2px solid #dc3545;
    color: #721c24;
    text-decoration-color: #dc3545;
  }
  
  .document-text :deep(.issue-highlight.issue-warning) {
    background: rgba(253, 126, 20, 0.15);
    border-bottom: 2px solid #fd7e14;
    color: #856404;
    text-decoration-color: #fd7e14;
  }
  
  .document-text :deep(.issue-highlight.issue-missing:hover) {
    background: rgba(255, 193, 7, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
  }
  
  .document-text :deep(.issue-highlight.issue-error:hover) {
    background: rgba(220, 53, 69, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
  }
  
  .document-text :deep(.issue-highlight.issue-warning:hover) {
    background: rgba(253, 126, 20, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(253, 126, 20, 0.3);
  }
  
  /* 严重程度样式 */
  .document-text :deep(.issue-highlight.issue-high) {
    border-left: 3px solid #dc3545;
    padding-left: 8px;
  }
  
  .document-text :deep(.issue-highlight.issue-medium) {
    border-left: 3px solid #ffc107;
    padding-left: 8px;
  }
  
  .document-text :deep(.issue-highlight.issue-low) {
    border-left: 3px solid #28a745;
    padding-left: 8px;
  }
  
  /* 批注样式 */
  .annotation {
    position: absolute;
    z-index: 1000;
  }
  
  .annotation-marker {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #5b7cff 0%, #a685ff 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(91, 124, 255, 0.3);
    transition: all 0.3s;
  }
  
  .annotation-marker:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(91, 124, 255, 0.5);
  }
  
  .annotation-marker .el-icon {
    font-size: 12px;
  }
  
  .annotation-popup {
    position: absolute;
    top: 32px;
    left: -150px;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(91, 124, 255, 0.1);
    z-index: 1001;
  }
  
  .annotation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(235, 238, 245, 0.6);
    background: linear-gradient(135deg, rgba(91, 124, 255, 0.05) 0%, rgba(166, 133, 255, 0.05) 100%);
    border-radius: 12px 12px 0 0;
  }
  
  .annotation-title {
    font-size: 14px;
    font-weight: 600;
    color: #5b7cff;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  
  .annotation-title::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #5b7cff;
    border-radius: 50%;
  }
  
  .annotation-content {
    padding: 16px;
  }
  
  .annotation-text {
    font-size: 14px;
    color: #2c3e50;
    line-height: 1.6;
    margin-bottom: 12px;
  }
  
  .annotation-suggestion {
    padding: 12px;
    background: rgba(91, 124, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid #5b7cff;
  }
  
  .suggestion-label {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
  }
  
  /* 空状态 */
  .empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    text-align: center;
  }
  
  .empty-icon {
    color: rgba(91, 124, 255, 0.2);
    margin-bottom: 32px;
    animation: float 3s ease-in-out infinite;
  }
  
  @keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
  }
  
  .empty-title {
    font-size: 22px;
    color: #2c3e50;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
  }
  
  .empty-desc {
    font-size: 16px;
    color: #64748b;
    line-height: 1.6;
    max-width: 400px;
  }
  
  /* 分析中状态 */
  .analyzing-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
  }
  
  .analyzing-content {
    text-align: center;
  }
  
  .analyzing-icon {
    color: #5b7cff;
    animation: spin 2s linear infinite;
    margin-bottom: 32px;
    filter: drop-shadow(0 4px 8px rgba(91, 124, 255, 0.3));
  }
  
  @keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
  }
  
  .analyzing-title {
    font-size: 22px;
    color: #2c3e50;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
  }
  
  .analyzing-desc {
    font-size: 16px;
    color: #64748b;
    line-height: 1.6;
  }
  
  /* 结果内容 */
  .result-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
  }
  
  .result-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 36px;
  }
  
  .summary-item {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.9) 100%);
    padding: 24px 20px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid rgba(91, 124, 255, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
  }
  
  .summary-item:hover {
    border-color: rgba(91, 124, 255, 0.2);
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(91, 124, 255, 0.15);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 255, 0.95) 100%);
  }
  
  .summary-label {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 12px;
    font-weight: 500;
    letter-spacing: -0.01em;
  }
  
  .summary-value {
    font-size: 28px;
    font-weight: 800;
    color: #2c3e50;
    letter-spacing: -0.02em;
  }
  
  .text-success {
    color: #10b981 !important;
  }
  
  .text-warning {
    color: #f59e0b !important;
  }
  
  .text-danger {
    color: #ef4444 !important;
  }
  
  /* 审核结果 */
  .audit-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
  
  .audit-document {
    border: 1px solid #ebeef5;
    border-radius: 8px;
    overflow: hidden;
    background: white;
  }
  
  .doc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #ebeef5;
  }
  
  .doc-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #303133;
  }
  
  .doc-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 16px;
  }
  
  .status-pass {
    color: #67c23a;
    background: rgba(103, 194, 58, 0.1);
  }
  
  .status-warning {
    color: #e6a23c;
    background: rgba(230, 162, 60, 0.1);
  }
  
  .status-error {
    color: #f56c6c;
    background: rgba(245, 108, 108, 0.1);
  }
  
  .doc-content {
    padding: 20px;
  }
  
  /* 问题列表 */
  .audit-issues {
    margin-bottom: 20px;
  }
  
  .issue-item {
    border: 1px solid #ebeef5;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
    background: #fafbfc;
  }
  
  .issue-header {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
  }
  
  .issue-type {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
  }
  
  .type-missing {
    background: rgba(230, 162, 60, 0.1);
    color: #e6a23c;
  }
  
  .type-error {
    background: rgba(245, 108, 108, 0.1);
    color: #f56c6c;
  }
  
  .type-warning {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
  }
  
  .type-info {
    background: rgba(64, 158, 255, 0.1);
    color: #409eff;
  }
  
  .issue-severity {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
  }
  
  .severity-high {
    background: rgba(245, 108, 108, 0.1);
    color: #f56c6c;
  }
  
  .severity-medium {
    background: rgba(230, 162, 60, 0.1);
    color: #e6a23c;
  }
  
  .severity-low {
    background: rgba(64, 158, 255, 0.1);
    color: #409eff;
  }
  
  .issue-description {
    font-size: 14px;
    color: #303133;
    margin-bottom: 8px;
    line-height: 1.5;
  }
  
  .issue-suggestion {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 14px;
    color: #67c23a;
    background: rgba(103, 194, 58, 0.05);
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 8px;
  }
  
  /* 标注 */
  .issue-annotations {
    border-top: 1px solid #ebeef5;
    padding-top: 12px;
  }
  
  .annotation-item {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 13px;
  }
  
  .annotation-marker {
    background: #409eff;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
  }
  
  .annotation-content {
    color: #606266;
    line-height: 1.4;
  }
  
  /* 缺失内容 */
  .missing-content {
    border: 1px solid #e6a23c;
    border-radius: 6px;
    padding: 16px;
    background: rgba(230, 162, 60, 0.05);
    margin-bottom: 16px;
  }
  
  .missing-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #e6a23c;
    margin-bottom: 12px;
  }
  
  .missing-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  
  .missing-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #606266;
  }
  
  .missing-item .el-icon {
    color: #e6a23c;
  }
  
  /* 通过消息 */
  .pass-message {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #67c23a;
    background: rgba(103, 194, 58, 0.05);
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid rgba(103, 194, 58, 0.2);
  }
  
  /* 响应式设计 */
  @media (max-width: 1400px) {
    .assistant-container {
      max-width: 100%;
      gap: 20px;
    }
    
    .left-panel {
      width: 380px;
    }
  }
  
  @media (max-width: 1200px) {
    .doc-assistant {
      padding: 20px;
    }
    
    .assistant-container {
      flex-direction: column;
      height: auto;
      gap: 20px;
    }
    
    .left-panel {
      width: 100%;
      max-width: none;
    }
    
    .right-panel {
      min-height: 600px;
    }
    
    .result-summary {
      grid-template-columns: repeat(2, 1fr);
      gap: 16px;
    }
  }
  
  @media (max-width: 768px) {
    .doc-assistant {
      padding: 16px;
    }
    
    .assistant-container {
      gap: 16px;
    }
    
    .panel-header {
      padding: 24px 20px 20px;
    }
    
    .panel-header h2 {
      font-size: 24px;
    }
    
    .upload-section,
    .config-section {
      padding: 20px;
    }
    
    .action-buttons {
      padding: 20px;
      flex-direction: column;
      gap: 12px;
    }
    
    .result-summary {
      grid-template-columns: 1fr;
      gap: 12px;
    }
    
    .summary-item {
      padding: 20px 16px;
    }
    
    .doc-header {
      flex-direction: column;
      align-items: flex-start;
      gap: 12px;
      padding: 16px 20px;
    }
    
    .sub-config-item {
      padding: 16px;
      margin-bottom: 16px;
    }
  }
  
  /* 统一项目滚动条样式 */
  :deep(*::-webkit-scrollbar) {
    width: 6px;
    height: 6px;
  }
  
  :deep(*::-webkit-scrollbar-track) {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
  }
  
  :deep(*::-webkit-scrollbar-thumb) {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    transition: all 0.3s;
  }
  
  :deep(*::-webkit-scrollbar-thumb:hover) {
    background: rgba(0, 0, 0, 0.35);
  }
  
  /* 容器滚动条 */
  .left-panel::-webkit-scrollbar,
  .tree-container::-webkit-scrollbar,
  .document-list::-webkit-scrollbar,
  .result-content::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  
  .left-panel::-webkit-scrollbar-track,
  .tree-container::-webkit-scrollbar-track,
  .document-list::-webkit-scrollbar-track,
  .result-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
  }
  
  .left-panel::-webkit-scrollbar-thumb,
  .tree-container::-webkit-scrollbar-thumb,
  .document-list::-webkit-scrollbar-thumb,
  .result-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
  }
  
  .left-panel::-webkit-scrollbar-thumb:hover,
  .tree-container::-webkit-scrollbar-thumb:hover,
  .document-list::-webkit-scrollbar-thumb:hover,
  .result-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.35);
  }

  /* 运行按钮样式 */
  .run-button {
    background: linear-gradient(135deg, #5b7cff 0%, #a685ff 100%);
    border: none;
    color: white;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
  }

  .run-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(91, 124, 255, 0.3);
  }

  .run-button:active {
    transform: translateY(0);
  }

  .run-button:disabled {
    opacity: 0.6;
    transform: none;
    box-shadow: none;
  }

  .loading-icon {
    animation: spin 1.2s linear infinite;
    color: white;
  }

  @keyframes spin {
    0% {
      transform: rotate(0deg);
    }
    100% {
      transform: rotate(360deg);
    }
  }

  /* 加载状态下的按钮效果 */
  .run-button:loading {
    background: linear-gradient(135deg, #4a6bff 0%, #8f6bff 100%);
    cursor: not-allowed;
  }

  /* 脉冲效果 */
  .run-button:loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: pulse 2s infinite;
  }

  @keyframes pulse {
    0% {
      left: -100%;
    }
    100% {
      left: 100%;
    }
  }

  /* 页面加载动画样式 */
  .page-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
  }

  .loading-container {
    text-align: center;
    padding: 40px;
  }

  .loading-spinner {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 32px;
  }

  .spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top: 3px solid #5b7cff;
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
  }

  .spinner-ring:nth-child(2) {
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
    border-top-color: #a685ff;
    animation-delay: 0.5s;
  }

  .spinner-ring:nth-child(3) {
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border-top-color: #ff6b6b;
    animation-delay: 1s;
  }

  .loading-text h3 {
    color: #2c3e50;
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 16px 0;
  }

  .loading-text p {
    color: #6c757d;
    font-size: 16px;
    margin: 0;
    font-weight: 500;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  @keyframes spin {
    0% {
      transform: rotate(0deg);
    }
    100% {
      transform: rotate(360deg);
    }
  }

  /* 下载区域样式 */
  .download-section {
    padding: 12px;
    background: linear-gradient(135deg, rgba(91, 124, 255, 0.05) 0%, rgba(166, 133, 255, 0.05) 100%);
    border-radius: 16px;
    border: 1px solid rgba(91, 124, 255, 0.1);
    text-align: center;
  }

  .download-btn {
    background: linear-gradient(135deg, #5b7cff 0%, #a685ff 100%);
    border: none;
    border-radius: 12px;
    padding: 12px 32px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    box-shadow: 0 4px 16px rgba(91, 124, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(91, 124, 255, 0.4);
  }

  .download-btn:active {
    transform: translateY(0);
  }

  .download-info {
    margin-top: 16px;
  }

  .info-text {
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
  }
  </style>